package CreationalPatterns.Single;
/*
懒汉式，线程安全
 */
public class SingleObject3 {

  private static SingleObject3 instance = new SingleObject3();

  private SingleObject3(){};

  public static synchronized SingleObject3 getInstance() {
    if (instance == null){
      instance = new SingleObject3();
    }
    return instance;
  }

  public void show(){
    System.out.println("懒汉式，线程安全");
  }
}
